/*************************************************
* Title：TinyToolKit
* Author：Opportunity 
* Describe：
* CreateTime：2020-04-28 17:46:04
* Version：1.0
* Modify Recorder：
*************************************************/
using System.Collections;
using System.Collections.Generic;
using TinyToolKit;
using UnityEditor;
using UnityEditor.Graphs;
using UnityEngine;

namespace TinyToolKitEditor
{
    [CustomPropertyDrawer(typeof(HelpBoxAttribute))]
    public class HelpBoxDrawer : DecoratorDrawer
    {
        private HelpBoxAttribute Attribute => attribute as HelpBoxAttribute;
        private float _height = EditorGUIUtility.singleLineHeight * 2.5f; 
        private float _spacing = EditorGUIUtility.standardVerticalSpacing;

        public override float GetHeight()
        {
            return _height + _spacing * 2;
        }

        public override void OnGUI(Rect position)
        {
            position.height = _height;
            position.y += _spacing;
            EditorGUI.HelpBox(position,Attribute.message,(MessageType)Attribute.helpBoxType);
        }
    }
}

